package controllers;

import java.awt.event.ActionEvent;
import java.sql.ResultSet;
import java.util.Vector;

import models.CustomTable;
import models.CustomTableModel;
import models.ProcessDeliveryModel;

import dialogs.ProcessDeliveryDialog;

import system.View;

public class ProcessDeliveryController extends AbstractController 
{
	private ProcessDeliveryModel deliveryModel = new ProcessDeliveryModel();
	
	public ProcessDeliveryController(View v)
	{
		super(v);
	}

	public void actionPerformed(ActionEvent e) 
	{
		String actionCommand = e.getActionCommand();
		if (actionCommand.equals("Process Delivery"))
		{
			showDialogWindow(new ProcessDeliveryDialog(view, this));
			//System.out.println("Anuj2");
			//showDialogWindow(new ProcessDeliveryDialog(view, actionCommand,
					//"Process Delivery", new String[] { "ReceiptID"}, this));
		}

	}
	
	public int processDelivery(String receipt)
	{
		int receiptId;
		if(receipt.length()==0)
			return VALIDATIONERROR;
		receiptId = Integer.valueOf(receipt);
		if(deliveryModel.updateDeliveryDate(receiptId)==false)
			return operationFailure();
		return operationSuccess();
	}
	
	@Override
	public int validateInsert(Vector<String> s) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void show() {

	}

	@Override
	public int validateDelete(Vector<String> s) {
		// TODO Auto-generated method stub
		return 0;
	}

}
